package com.globallogic.dailyplanner.webservice.impl;

import java.util.Calendar;

import javax.jws.WebMethod;
import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

import com.globallogic.dailyplanner.service.DailyPlanService;
import com.globallogic.dailyplanner.webservice.DailyPlanWS;

@WebService(serviceName="DailyPlanWebService", endpointInterface="com.globallogic.dailyplanner.webservice.DailyPlanWS")
public class dailyPlanWSImpl extends SpringBeanAutowiringSupport implements DailyPlanWS {

	@Autowired
	DailyPlanService dailyPlanService;
	
	@WebMethod
	@Override
	public long getCountOfDailyPlans() {
		return dailyPlanService.getCountOfDailyPlans();
	}

	@WebMethod
	@Override
	public long getDailyPlansByDate(Calendar startDate, Calendar endDate) {
		return dailyPlanService.getAllByDate(startDate, endDate).size();
	}
}
